package core;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

import reporting.Report;

public class PropertiesManager
{

	private static Properties prop = null;

	public static void initialise()
	{
		prop = new Properties();

		try
		{
			// load a properties file
			prop.load(new FileInputStream("config.properties"));

		}
		catch (IOException ex)
		{
			ex.printStackTrace();
		}
	}

	public static String getString(String key)
	{
		return prop.getProperty(key);
	}

	public static int getInt(String key)
	{
		int value = 0;
		try
		{
			value = Integer.parseInt(prop.getProperty(key));
		}
		catch (NumberFormatException ex)
		{
			Report.error("The property with key = " + key
					+ " CAN NOT be parsed to int.");
		}
		return value;
	}
}
